package com.example.piece.ui.activity

/**
 * 粉丝和关注详情
 *
 */
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment
import com.therouter.router.Autowired
import com.therouter.router.Route
import com.example.base.ext.getViewModel
import com.example.piece.App
import com.example.piece.R
import com.example.piece.constant.Key
import com.example.piece.constant.RoutePath
import com.example.piece.databinding.ActivityFunsAndGzactivityBinding
import com.example.piece.ui.adapter.MsgAdapter
import com.example.piece.ui.adapter.ViewPagerAdapter
import com.example.piece.ui.fragment.*
import com.example.piece.vm.UserViewModel
@Route(path = RoutePath.MAIN_FUN_GZ_ACTIVITY)
class FansAndGZActivity : Layer3Activity<ActivityFunsAndGzactivityBinding,ViewDataBinding>() {

    override val isTransparentStatusBar: Boolean = true
    override val isLockPortrait: Boolean = true
    override val statusBarAlpha: Int = 0
    override val isDarkMode: Boolean = true
    override val isFitsSystemWindows: Boolean = true
    override val leftIcon1Res: Int = R.drawable.ic_back
    override val centerLayoutRes: Int
        get() = R.layout.activity_funs_and_gzactivity
    override val title: String
        get() = H5_TITLE

    @JvmField
    @Autowired(name = Key.DataKey.H5_TITLE)
    var H5_TITLE: String = ""
    /**  消息类型   type=0 关注 type=1  粉丝**/
    @JvmField
    @Autowired(name = Key.DataKey.FANS_GZ_TYPE)
    var FANS_GZ_TYPE: Int = 0


    override fun onClickLeftIcon1(view: View) {
        onBackPressed()

    }

    override fun initData(savedInstanceState: Bundle?) {
        super.initData(savedInstanceState)
        val fragments = mutableListOf<Fragment>()

        val titles = listOf("关注", "粉丝")
        fragments.add(GuanZhuFragment.newInstance(App.userLoginCodeEntity.user.userId))
        fragments.add(FansFragment.newInstance(App.userLoginCodeEntity.user.userId))
        mCenterViewBinding?.vp?.adapter = ViewPagerAdapter(supportFragmentManager, fragments, titles)
        mCenterViewBinding?.tab?.setupWithViewPager(mCenterViewBinding?.vp)
        mCenterViewBinding?.vp?.offscreenPageLimit = 2
        mCenterViewBinding?.vp?.setCurrentItem(FANS_GZ_TYPE)
    }

}